
// autocomplete tags
function montaLinhaTags() {
 valIni = document.getElementById("txtTags").value;
 ajax = ajaxInit();
 if(ajax) {
 	if(valIni != 0) {
	   ajax.open("GET", "../lib/concat_tags.php?tag=" + valIni, true);
	   ajax.onreadystatechange = function() {
		 if(ajax.readyState == 4) {
		   if(ajax.status == 200) {
			 document.getElementById("linhaTags").innerHTML = ajax.responseText;
			 document.getElementById("txtTags").value = "";
		   } else {
			 alert(ajax.statusText);
		   }
		 }
	   }
	   ajax.send(null);
   }
 }
}

// autocomplete tags
function excluiLinhaTags(valIni) {
 ajax = ajaxInit();
 if(ajax) {
 	if(valIni != 0){
	   ajax.open("GET", "../lib/delete_tags.php?tag=" + valIni, true);
	   ajax.onreadystatechange = function() {
		 if(ajax.readyState == 4) {
		   if(ajax.status == 200) {
			 document.getElementById("linhaTags").innerHTML = ajax.responseText;
		   } else {
			 alert(ajax.statusText);
		   }
		 }
	   }
	   ajax.send(null);
   }
 }
}

// autocomplete tags
function onKeyFirefox(e) {
	//alert(e.keyCode);
Key = (e.which)?e.which:window.event.keyCode; 	
//alert(Key);
	if ((Key == 13) || (Key == 32)){
        montaLinhaTags();
	}
}

function onkeyIE()  {
	alert(window.event.keyCode);         
     if ((window.event.keyCode == 13) || (window.event.keyCode == 32)) {                  
     	montaLinhaTags();         
     }     
}